<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style>
  .aligns{text-align:center}
  .right{float:right}
  </style>
  <title>e网批发管理后台</title>
  <link type="text/css" rel="stylesheet" href="time/css/lanrenzhijia.css" />
  <link rel="stylesheet" type="text/css" href="time/css/jquery-ui.css" />
  <script type="text/javascript" src="js/jquery.min.js"></script>
  <script src="time/js/jquery-ui-1.10.4.custom.min.js"></script>
  <script src="time/js/jquery.ui.datepicker-zh-CN.js"></script>
  <script src="time/js/jquery-ui-timepicker-addon.js"></script>
  <script src="time/js/jquery-ui-timepicker-zh-CN.js"></script>
  <script language="javascript" type="text/javascript" src="datepicker/WdatePicker.js"></script>
  <?php include("common/conn.php"); if($_SESSION['userid']==""){echo "<script>window.location.href='login.php';</script>";} 


//提交审核中
if($_GET['pass']=='1'){
  if( mysql_query("UPDATE shop_pay SET status=1 where numbers=".$_GET['number']) ){
    $money = mysql_fetch_assoc( mysql_query('select * from shop where shopid='.$_GET['sid']) )['money'];
    $money = eval($_GET['amount'] + $money);
    mysql_query("INSERT INTO shop_pay(sid,active_pay,amount,status) VALUES($_GET[sid],2,$money,1)");
    echo "<script>alert('提交审核成功！');window.location.href='walletMoney.php?tx=shop';</script>";
  }

}

if (isset($_REQUEST['date']) && isset($_REQUEST['dateL'])) {
  $date=$_REQUEST['date'];
  $dateL=$_REQUEST['dateL'];
  $date=date("Y-m-d",strtotime($date));
  $lateL=date("Y-m-d",strtotime($dateL));
  $between=" and created_at>'".$date."' and created_at<'".$lateL."'";
}else{
  $date=date("Y-m-d",(time() - 3600*24*15));
  $dateL=date("Y-m-d",(time() + 3600*12));
  $between=" and created_at>'".$date."' and created_at<'".$dateL."'";
}



  ?>
  <script type="text/javascript" src="js/jquery.min.js"></script>
  <link href="css/styles.css" rel="stylesheet" type="text/css" />
  <link href="css/style2.css" rel="stylesheet" type="text/css" />

  <script type="text/JavaScript">
    <!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body>

  <!--header-->
  <?php include("common/header.php");?>
  <!--header end-->



  <!-- staqrt subnav -->
  <div id="sub_nav">

  <div class="container aligns" >

    <form style="width:100%" action="" method="post">
      <span>开始时间</span>
      <input name="date" type="text" value="<?php echo $date; ?>" style="cursor:pointer;" onClick="WdatePicker()"/>
      &nbsp;&nbsp;&nbsp;
      <span>结束时间</span>
      <input name="dateL" type="text" value="<?php echo $dateL; ?>" style="cursor:pointer;" onClick="WdatePicker()"/>
      <input type="submit" value="提交" class="submit">
    </form>
  </div>


  </div>
  <div class="container_12">
    <!-- <input type="button" class="submit" value="新增热词" onclick="add();"> -->
  </div>
  <!-- end sub_nav -->
  <div class="container_12" style="background: #fff; border:0px; position:relative">

  </div>
    <form action="?del=ok" method="post">
      <div class="container_12">

        <table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <th width="5%" scope="col">
              <input type="checkbox" name="checkbox" id="checkbox" class="checkall" /><label for="checkbox"></label></th>
              <th width="13%" scope="col">单号</th>
              <th width="13%" scope="col">渠道</th>
              <th width="18%" scope="col">提现金额</th>
              <th width="18%" scope="col">状态</th>
              <th width="18%" scope="col">时间</th>
              <th width="13%" scope="col">操作</th>
            </tr> 
            
            <?php 
            mysql_query('SET NAMES UTF8');  

            $ren="1";
            $sex="0";
$perNumber=20; //每页显示的记录数
$page=$_GET['page']; //获得当前的页面值
if (!isset($page)) {
  $page=1;
} //如果没有值,则赋值1
$startCount=($page-1)*$perNumber; //分页开始,根据此方法计算出开始

if ($_REQUEST['tx']=="user") {
  $count=mysql_query("select count(*) from user_pay where status=1");
  $rert30=mysql_query("select * from user_pay where status=1 limit $startCount,$perNumber");
}else{
  $count=mysql_query("select count(*) from shop_pay where status=1");
  $rert30=mysql_query("select * from shop_pay where status=1 limit $startCount,$perNumber");
}     

//获得记录总数
$rs=mysql_fetch_array($count); 
$totalNumber=$rs[0];
$totalPage=ceil($totalNumber/$perNumber); //计算出总页数
		

//var_dump("select * from user order by id desc limit $startCount,$perNumber");die;
while($sdg30=mysql_fetch_array($rert30)){

  ?>

  <tr>
    <td scope='col'><input type="checkbox" name="checkbox" id="checkbox" class="checkall" /><label for="checkbox"></label></td>
    <td scope="col"><?php echo $sdg30[numbers];?></td>
    <td scope="col"><?php if($sdg30[style]){
    switch ($sdg30[style]) {
      case 1:
        echo '微信';
        break;

      case 2:
        echo '微信';
        break;

      case 3:
        echo '微信';
        break;

      default:
        echo '';
        break;
    }}
    ?></td>
    <td scope="col"><?php echo $sdg30[amount];?></td>
    <td scope="col"><?php 
      if($sdg30[status]=='0'){echo '审核中';}elseif($sdg30[status]=='1'){echo '审核成功';}
     ?></td>
     <td scope="col"><?php echo $sdg30[created_at] ?></td>
     <?php if($sdg30[status]=='0'){ ?>
    <td scope="col"><a href="javascript:void(0);" onclick='passh("<?php echo 'walletMoney.php?tx=shop&sid='.$sdg30[sid].'&number='.$sdg30[numbers].'&amount='.$sdg30[amount]; ?>")' >审核</a></td>
    <?php } ?>
  </tr> 



  <?php }?>
</table>
<div class="grid_12">

  <div class="clearfix"><!-- <input name="" type="submit" value="删除选中" class="submit"/> --></div>

  <ul id="pagination">



    <?php  

    if ($page > 1) { //上一页 ?>
    <li><a     href="?page=1&keywords=<?php echo $_REQUEST[keywords]; ?>">首页</a></li>
    <li><a     href="?page=<?php echo ($page-1); ?>&keywords=<?php echo $_REQUEST[keywords]; ?>">上一页</a></li>
    <?php }

    ?>

    <li class="active"><?php echo $page;?></li>

    <?php



    if ($_GET[page]!=$totalPage) { //下一页 ?>
    <li><a     href="?page=<?php echo ($page+1); ?>&keywords=<?php echo $_REQUEST[keywords]; ?>">下一页</a></li>
    <?php }

    if ($totalPage>1) { //下一页 ?>
    <li><a     href="?page=<?php echo $totalPage; ?>&keywords=<?php echo $_REQUEST[keywords]; ?>">尾页</a></li>

    <?php }?>


  </ul>

</div>           
</div>
</form>
</body>
<script type="text/javascript">
  function passh(url){
    document.location.href=url+'&pass=1';
  }

  $('.onS').on({
    click: function(){
      $('.onS').removeClass("sub_nav_active");
      $(this).addClass("sub_nav_active");
    },
  });
</script>
</html>
